
#include "ds_conf.h"

void DSConfig::GotKeyValMap(const map<string, string> &kv_map) {
  threads = GetIntValue("threads", 10);
  listen_port = GetIntValue("listen_port", 8080);
  client_timeout = GetIntValue("client_timeout", 60);
  rotate_megabytes = GetIntValue("rotate_megabytes", 1024);
  data_path_count = GetIntValue("data_path_count", 1);
  subdir_count_per_dir = GetIntValue("subdir_count_per_dir", 256);

  pid_file = GetStringValue("pid_file");
  log_file = GetStringValue("log_file");
  
  const char *data_path = GetStringValue("data_path0");
  if (data_path)
    data_paths.push_back(data_path);

  for (int i = 1; i < data_path_count; i++) {
    char dir_name[64];
    sprintf(dir_name, "data_path%d", i);

    if ((data_path = GetStringValue(dir_name)) == NULL)
      break;

    data_paths.push_back(data_path);
  }
}

